<template>
  <div id="window">
    <div v-for="(item, index) in message" :key="index" class="item" @click="itemClick(index)">
      <div :style="{borderColor: color}">{{ item }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  inject: ['home'],
  data() {
    return {
      message: ['技 术\n博 客', '个 人\n项 目', '视 频\n创 作', '兴 趣\n爱 好'],
      color: '#fff',
      colorday: '#fff',
      colornight: 'rgba(0, 0, 0, .6)'
    };
  },
  computed:{
    nightData() {
      return this.$store.state.isNight
    }
  },
  watch:{
    nightData(newData, oldData) {
      if(newData){
        this.color = this.colorday
      } else {
        this.color = this.colornight
      }
    }
  },
  methods: {
    itemClick(index) {
      this.home.silde(index)
    }
  },
};
</script>

<style scoped>
#window {
  margin: 0;
  padding: 0;
  height: 340px;
  width: 320px;
  display: flex;
  flex-wrap: wrap;
  /* background: url(https://wx3.sinaimg.cn/large/006yjJnHgy1gebtrox7r8j30u011ix6p.jpg); */
  background: url(../assets/img/window.jpg);
  background-size: 100% auto;
}

.item {
  font-family: pangmeng;
  height: 160px;
  width: 160px;
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 40px;
  text-align: center;
  line-height: 80px;
  transition: all .5s;
}

.item:hover {
  color: Violet;
  cursor: pointer;
}

.item div {
  border: 5px solid;
}
</style>
